package album

import (
	"blog/app/model"
	"github.com/go-playground/validator/v10"
)

type Album struct {
	ID          int    `gorm:"column:id;primaryKey" json:"id"`
	Name        string `gorm:"column:name" json:"name" `
	Describe    string `gorm:"column:describe" json:"describe"`
	IsRecommend int    `gorm:"column:is_recommend" json:"is_recommend"`
	Cover       string `gorm:"column:cover" json:"cover"`
	model.SoftModel
}

func (receiver Album) TableName() string {
	return "p_album"
}

type ListsAlbum struct {
	Album
	Count int `json:"count"`
}

type EditReqAlbum struct {
	Path string `validate:"test,required" validateErr:"test:这是错误,required:图片路径不能为空"`
	Name string
}

func (e EditReqAlbum) Custom(validate *validator.Validate) {
	validate.RegisterValidation("test", func(fl validator.FieldLevel) bool {
		return true
	})
}
